import React, { Component } from 'react'
import axios from "axios"
import List from '../../component/List'
export class homePage extends Component {

  constructor(props) {
    super(props)
  this.state={
    list:[]
  }
  
  }
  componentDidMount() { 
    axios.get("/list").then((res)=>{
      // console.log(res.data)
      this.setState({
        list: res.data
      })
   
    })
 
   }
  render() {
    const {list}=this.state
    return (
      <div>
        <button onClick={()=>{
          // this.props.history.push("/detalis")
          // this.props.history.push('/detalis',{
          //   name:"xuez",
          //   age:18
          // })
          this.props.history.push("/detalis/"+"123")

        }}>搜素</button>
        <List list={list}></List>
      


      </div>
    )
  }
}

export default homePage